package com.bwie.gddproject.index.precenter;

import com.bwie.gddproject.index.model.IIndexModel;
import com.bwie.gddproject.index.model.bean.IndexBean;
import com.bwie.gddproject.index.model.IndexModel;
import com.bwie.gddproject.index.view.fragment.IIndexFragment;
import com.bwie.gddproject.net.OnNetLitenner;

/**
 * Created by 我走路带风 on 2017/12/13.
 */

public class IndexPrecenter implements IIndexPrecenter {
    private IIndexModel indexModel;
    private IIndexFragment indexFragment;

    public IndexPrecenter(IIndexFragment indexFragment) {
        this.indexFragment = indexFragment;
        indexModel = new IndexModel();
    }

    @Override
    public void getDatas() {
        indexModel.getDate(new OnNetLitenner<IndexBean>() {
            @Override
            public void success(IndexBean indexBean) {
                indexFragment.showDates(indexBean);
            }

            @Override
            public void fail(String errer) {
                indexFragment.toast(errer);
            }
        });
    }
}
